<?php
ob_start();
session_start();
include_once('config/setting.php');
?>
<title>The Century - Admin Panel</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//-->
</script>
<body style="padding-top:100px" >
<div align="center" >
        <table  width="400px" border="0" align="center" cellpadding="0" cellspacing="0"  >
		  <tr><td colspan="3" height="10px"></td></tr>	
          <tr>
            <th colspan="3" height="60px" style="font-family:Arial, Helvetica, sans-serif;font-size:18px;font-weight:normal; color:#656565;">THE CENTURY ADMIN PANEL</th>
          </tr>
			<?php
			if(isset($_POST['loginSubmit'] )){
				$email=$_POST['email'];
				$password=$_POST['password'];
				//$query_login=mysql_query("select * from tbl_user where email = '".$email."' and password='".$password."' limit 1" ) or die (mysql_error()); ;
				   //if(mysql_num_rows($query_login)){
					if($email == 'admin' && $password == 'admin' ){   
						//$row_login = mysql_fetch_array($query_login);
						//$userID   =  $row_login['userID'];
						//$usertype =  $row_login['usertype'];
						//$fullname =  $row_login['fullname'];
						//$_SESSION['userid'] =  $userID;
						//$_SESSION['usertype']  =  $usertype;
						//$_SESSION['fullname']  =  $fullname;
						
						$_SESSION['userid'] =  '11111';
						$_SESSION['usertype']  =  'Super Admin';
						$_SESSION['fullname']  =  'Administrator';
						header('location: main.php');
						exit();
					}else{
						echo "<tr><td colspan='3' align ='center' height='30px' valign='middle'><font color=orange face='arial' size='2'><b>Login Incorrect.</b></font></td></tr>";
					}
			}
			?>
		  <form name="logForm" method="POST" action="" >		  
          <tr>
		  	<td width="6%" nowrap bgcolor="#E5E5E5"><img src="images/arrow.jpg"></td>
            <td width="21%" nowrap bgcolor="#E5E5E5"><div align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#333333;"> User Name</div></td>
            <td width="73%" bgcolor="#E5E5E5">&nbsp;
            <input name="email" size="20" style="width:200px" id="Email Address" onfocusout=FocusOut(this) onfocusin=FocusIn(this)></td>
          </tr>
		  <tr><td colspan="3" height="20px"></td></tr>
          <tr>
		  	<td width="6%" nowrap bgcolor="#E5E5E5"><img src="images/arrow.jpg"></td>
            <td height="30" bgcolor="#E5E5E5"><div align="right" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#333333;">Password:</div></td>
            <td height="30"  bgcolor="#E5E5E5">&nbsp;
            <input name="password" type="password" style="width:200px" size="20" onfocusout=FocusOut(this) onfocusin=FocusIn(this)></td>
          </tr>
          <tr>
            <td colspan="3">&nbsp;&nbsp;&nbsp;
                <div align="center">
                  <input type="submit" value="LOGIN" name="loginSubmit" >
              </div></td>
          </tr>
		  </form>
          <tr><td colspan="3" height="10px"></td></tr>	
        </table>
      
	</td>
	<td>&nbsp;</td>
  </tr>
  <tr>
  </tr>
</table>
</div>
</body>
</html>
